package com.event.listener;

import com.event.listener.event.RefreashApplicationEvent;
import com.event.listener.event.RefreashEvent;
import com.event.listener.publish.RefreashApplicationPublisher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * @author shengtao
 * @Description: 启动前的准备
 * @date 2019/06/27 15:19
 */
@Component
public class ApplicationRunner implements CommandLineRunner {

    @Autowired
    private RefreashApplicationPublisher publisher;

    @Override
    public void run(String... args) throws Exception {
        RefreashEvent event = new RefreashEvent();
        event.setName("test3");
        RefreashApplicationEvent refreashApplicationEvent = new RefreashApplicationEvent(event);

        this.publisher.publishEvent(refreashApplicationEvent);
    }


}
